import { defineConfig } from "vite";
import { resolve } from "path";
import react from "@vitejs/plugin-react-swc";

// https://vitejs.dev/config/
export default defineConfig(() => {
  return {
    plugins: [react()],
    resolve: {
      alias: {
        "@": resolve(__dirname, "./src"),
      },
    },
    css: {
      preprocessorOptions: {
        less: {
          // modifyVars: {
          // 	"primary-color": "#1DA57A",
          // },
          math: "always",
          javascriptEnabled: true,
          // additionalData: `@import "@/styles/var.less";`,
        },
      },
    },
    server: {
      host: "0.0.0.0",
      port: 1111,
      proxy: {
        "/api": {
          target: "http://localhost:1112", // easymock
          changeOrigin: true,
          rewrite: (path) => path.replace(/^\/api/, ""),
        },
      },
    },
  };
});
